<template>
    <div class="addProject">
        <div class="header">
            <x-header :left-options="{backText:'',showBack: true}">添加项目
                <!-- <span slot="overwrite-left" class="iconfont icon-fanhui back"></span> -->
            </x-header>
        </div>
        <div class="content">
            <group>
                <x-input title='项目名称' type="tel"placeholder="请填写项目名称" v-model="proName"></x-input>
            </group>
        </div>

        <div class="submitButton submit" @click="submit">
            确认添加
        </div>
    </div>
</template>

<script>
import XHeader from 'vux/src/components/x-header/index.vue'
import Group   from 'vux/src/components/group/index.vue'
import XInput  from 'vux/src/components/x-input/index.vue'
export default {
    name:"addProject",
    components:{
        XHeader,
        Group,
        XInput,
    },
    data(){
        return{
            addUrl      : "/project/project_add",
            proName     : "",
        }
    },
    methods:{
        submit(){
            var _this = this;
            _this.proName = _this.proName.replace(/\s+/g, "");
            if( _this.proName == ""){
                _this.toastMsg("请填写项目名称");
            }else{
                _this.$http.get(_this.addUrl + "?title="+_this.proName+"&uidadd="+1).then(function(res){
                    if(res.data.code == 1){
                        _this.toastMsg("添加成功",'success');
                        _this.proName = "";
                    }
                });
            }
        }
    }
}
</script>

<style scoped lang='less'>
@bules:#38ADFF;
.addProject{
    margin-top: 50px;
    background-color: #F7F7F7;
    .back{
        font-size: 35px;
        color: @bules;
    }
}
@media (max-width:360px) {
    .weui-cells{
        font-size: 12px;
    }
    .submitButton{
    height: 40px !important;
    line-height: 40px !important;
  }
}
</style>

